#!/bin/bash


key=$1;
awkcommand=/wtt/bin/gawk4
awklib=/wtt/bin/lib/awk4extension/libmcrypt.so
if [ `/wtt/bin/OSBit` = 32 ]; then
	awkcommand=/wtt/bin/gawk4_32
	awklib=/wtt/bin/lib/awk4extension/libmcrypt_32.so
fi

$awkcommand -F , -v key="$key" -v lib="$awklib" 'BEGIN{extension(lib,"dlload");mcrypt_module_open("des","cfb",key);}
{
for(i=1;i<=NF;++i) {
	v=$i;
	if (i==1) v=mcrypt_generic($i);

	if (i==NF) printf("%s\n",v);
	else printf("%s,",v);
    }
}'

